<form method="post" action='javascript:void(0)' id="f1">

<div class="bodytabdiv">
<table class='bodytab' cellspacing='1'>
<tr>
	<th class='th' colspan='2'>{-if $L.id-}修改{-else-}添加{-/if-}管理员组</th>
</tr>

<tr>
	<td width='60'>组名</td>
	<td><input name='name' value='{-$L.name-}'></td>
</tr>




<tr>
	<td>栏目权限</td>
	<td id="left_power"><a class="updown0" href="#x1" name="x1">展开</a><div class="checkboxlist" style="display:none">{-$L.left_checkbox-}</div></td>
</tr>



<tr>
	<td>模块权限</td>
	<td id="mod_power"><a class="updown0" href="#x2" name="x2">展开</a><div class="checkboxlist" style="display:none" >{-$L.mod_checkbox-}</div></td>
</tr>


<tr>
	<td>表权限</td>
	<td id="tab_power"><a class="updown0" href="#x3" name="x3">展开</a><div class="checkboxlist" style="display:none">{-$L.tab_checkbox-}</div></td>
</tr>

<tr>
	<td>备注</td>
	<td>
		<a style="color:#936;">超级管理的不当操作往往会带来无法修复的数据结构破坏, 所以请慎重的为非开发人员授予该项操作权限!</a>  <br/> 
		<label for="boxhelp" title="可以帮助你向下控制树型节点"><input type="checkbox" id="boxhelp" checked="true"/>智能选择</label>
		<a href="javascript:void(0)" id="selAnti">反向选择</a>
		<a href="javascript:void(0)" id="selAll">全部取消</a> <br/>
		<a class="note">用户组成员有操作或者使用被选择选项的权限! 表权限中的表和字段不选择的话表示不对该用户组做权限检测!</a>

	</td>
</tr>

</table>
</div>


<input type='hidden' name='jurl' value='{-$_ENV.referer-}'>

<div class='bodysubmit'>
<input type='submit' value='递交'/>
<input type='reset' value='默认'/>
</div>

</form>

<div class='bodyfooter'>
	<a href='{-$_ENV.referer-}'>返回</a>
</div>

<script type="text/javascript">

(function(){
	var power	= {-$L.power_json|default:"[]"-}
	var sel		= function(id){
		if( $(id) ){
			 $(id).checked	= true;
		}
	}
	$('f1').addEvent('reset', (function(){
		setTimeout(function(){
			$$("#mod_power input,#left_power input,#tab_power input").each(function(el){
				el.checked = false ;
				return true;
			});
			if( power.length < 1){
				return false;
			}
			for(var i in power[0]){
				sel('left_' + i );
			}
			if( power.length < 2){
				return false;
			}
			for(var i in power[1]){
				sel('mod_' + i );
			}
			if( power.length < 3){
				return false;
			}
			for(var i in power[2]){
				$('tab_' + i).checked = true;
				var list = power[2][i];
				if( typeof list == 'object' ){
					for(var j in list){
						$('tab_' +i+ '_' + j) .checked = true;
						var list2 = list[j];						
						if( typeof list2 == 'object' ){
							for(var k in list2){
								sel('tab_' +i+ '_' + j + '_' + k);
							}
						}
					}
				}
			}
		}, 20);
		return arguments.callee;
	})());
})();


window.addEvent('domready', function(){
	$('selAnti').addEvent('click', function(){
		$$("#mod_power input,#left_power input,#tab_power input").each(function(el){
			el.checked = !el.checked ;
		});
	});
	$('selAll').addEvent('click', function(){
		$$("#mod_power input,#left_power input,#tab_power input").each(function(el){
			el.checked = false ;
		});
	});
	$$("#mod_power input,#left_power input,#tab_power input").addEvent('click', function(){
		if( !$('boxhelp').checked ){
			return true;
		}
		var _this	= this;
		try{
			if( _this.getParent().getNext().tagName === 'DIV' ){
				setTimeout(function(){
					_this.getParent().getNext().getElements('input').each(function(el){
						el.checked	= _this.checked;
					});
				}, 20);
			}
		}catch(e){}
	});

	$('f1').action	= "{-$body.url-}&act={-if $L.id-}eok&id={-$L.id-}{-else-}aok{-/if-}";

	var isp = false;
	$('f1').addEvent('submit', function(evt){
		if(isp) {
			evt.stop();
			alert('表单已经递交!');
			return false;
		}
		var e	= this.elements['name'];
		if( !e.value.match(/^([^\x00-\xff]|\w){1,15}$/) ){
			evt.stop();
			alert('组名只不能为空,并且不能包含特殊字符!');
			e.select();
			e.focus();
			return false;
		}
		isp	= true;
		return true;
	});
});

</script>